<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>表单编辑器</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <script type="text/javascript" charset="utf-8" src="../../../webjar/jquery/3.1.1/jquery.min.js"></script>
    <script src="../../../webjar/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="../../../webjar/layer/layer.js"></script>
    <script src="../../../webjar/plugins/layui/layui.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../Public/ServerPath.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../Public/ibcpLayer.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../Public/ibcpAjax.js"></script>
    <script type="text/javascript" charset="utf-8" src="ueditor.config_1.js"></script>
    <script type="text/javascript" charset="utf-8" src="ueditor.all.js"> </script>    
    <script type="text/javascript" charset="utf-8" src="util.js"> </script>    
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript" charset="utf-8" src="customizedBorder/customizedBorder.js"></script>
    <style type="text/css">
        div{
            width:100%;
        }
        #edui7 {
            padding-top: 10px;
        }
        #edui7_toolbarbox {
            display: none;
        }
    </style>
	<script>
	/*UE.commands["customizedBorder"] = {
        queryCommandState: function () {
			console.log(this);
            return getSelectedArr(this).length > 1 ? 0 : -1;
        },
        execCommand: function (cmd, value) {
            var cells, ut;
            cells = getSelectedArr(this);
            ut = getUETable(cells[0]);
            ut.setBackground(cells, value);
        }
    };*/
	</script>
</head>
<body>
<div>
    <script id="editor" type="text/plain" style="width:inherit;height:auto;margin-bottom:8px;"></script>
    <script>
        var Height = $(window).height() * 0.97;
        $('#editor').css('height',Height*0.92);

        // $('#edui7_toolbarbox').hide();
    </script>
</div>
<script type="text/javascript">
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor');
	ue.ready(function(){
		var css=ue.document.createElement('link');
		css.rel="stylesheet";
		css.type="text/css";
        css.href="../../../webjar/bootstrap/3.3.7-1/css/bootstrap.min.css";
		ue.document.head.getElementsByTagName('link')[0].prepend(css);
		ue.document.body.style.margin='0px';
		ue.document.body.style.padding='0px';
		ue.document.body.style.paddingLeft='25px';
		ue.document.body.style.paddingRight='25px';
		ue.document.body.style.paddingRight='25px';
	});

    var proDetailUrl = serverPath + 'craftProcessSteps/findCraftProcessStepDetail';

    //根据名称获取Url中某个参数的值
    function GetUrlParam(pname) {
        var reg = new RegExp("(^|&)" + pname + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]);
        return null;
    }

    $(function() {
        var proStepId = GetUrlParam('id');
        var datas = {'id':proStepId};
        if(proStepId == null) {
            return;
        }else {
            ibcpAjax.Select(proDetailUrl,datas,true,function(result) {
                var data = result.data;
                var resource = data["resource"];
                UE.getEditor('editor').execCommand('insertHtml', resource);
                // 显示资源不可编辑
                UE.getEditor('editor').setDisabled('fullscreen');
            });
        }
    });
</script>
</body>
</html>